i = imread('Fig0840_1303.tif',1);
>> frames = size(imfinfo('Fig0840_1303.tif'),1);
>> s1 = uint8(zeros([size(i) 1 2]));
>> s1(:,:,:,1) = i;
>> s1(:,:,:,2) = imread('Fig0840_1303.tif',frames);
>> size(s1)
 lut = 0:1/255:1;
 >> lut = [lut' lut' lut'];
>> m1(1) = im2frame(s1(:,:,:,1),lut);
>> m1(2) = im2frame(s1(:,:,:,2),lut);
>> size(m1)
%{ans = 

       cdata: [720x1280 uint8]
    colormap: [256x3 double]%}

>> implay(m1,0.5);
>> implay(m1);
%播放文件，0.5是帧/s

>> Z = peaks;
>> surf(Z)
>> axis tight manual
>> ax = gca;
>> ax.NextPlot = 'replaceChildren';
>> loops = 40;
>> F(loops) = struct('cdata',[],'colormap',[]);
>> for j = 1:loops
X = sin(j*pi/10)*Z;
surf(X,Z)
drawnow
F(j) = getframe;
end
%{由帧图像拼接视频结构对象%}
>> A = rand(900);
>> imwrite(A,'myGray.png')
%将矩阵转换成图片并且写入到一张图片内

>> im = image(rand(20));%这里构建一个图像对象
C = im.CData;%将对象的CData值保存起来，为后面的图像对象做准备
im.CDataMapping = 'scaled';%设置新的图像对象的显示形式
>> figure
>> image(im.CData,'CDataMapping','scaled')%使用image命令显示新的图像对象

%{Vector or matrix — This format defines indexed image data. Each element defines a color for one pixel of the image. 
%The elements map to colors in the colormap. The CDataMapping property controls the mapping method.
%3-D array of RGB triplets — This format defines true color image data using RGB triplet values. 
%Each RGB triplet defines a color for one pixel of the image. 
%An RGB triplet is a three-element vector that specifies the intensities of the red,
%green, and blue components of the color. 
%The first page of the 3-D array contains the red components, the second page contains the green components,
%and the third page contains the blue components. Since the image uses true colors instead of colormap colors
%, the CDataMapping property has no effect.%}
image(rand(20));colorbar
%'direct' — Interpret the values as indices into the current colormap. Values with a decimal portion are fixed to the nearest lower integer.
%If the values are of type double or single, then values of 1 or less map to the first color in the colormap.
%Values equal to or greater than the length of the colormap map to the last color in the colormap.
%{CDataMapping — Color data mapping method
'direct' (default) | 'scaled'
Color data mapping method, specified as 'direct' or 'scaled'. Use this property to control the mapping of color data values in
CData into the colormap. CData must be a vector or a matrix defining indexed colors. 
This property has no effect if CData is a 3-D array defining true colors.

The methods have these effects:

'direct' — Interpret the values as indices into the current colormap. Values with a decimal portion are fixed to the nearest lower integer.
If the values are of type double or single, then values of 1 or less map to the first color in the colormap. 
Values equal to or greater than the length of the colormap map to the last color in the colormap.
If the values are of type uint8, uint16, uint32, uint64 , int8, int16, int32, or int64, 
then values of 0 or less map to the first color in the colormap. 
Values equal to or greater than the length of the colormap map to the last color in the colormap (or up to the range limits of the type).
If the values are of type logical, then values of 0 map to the first color in the colormap and values of 1 map to the second color 
in the colormap.
'scaled' — Scale the values to range between the minimum and maximum color limits.
The CLim property of the axes contains the color limits.
%}
v = VideoReader('rhinos.avi');
v.VideoFormat
f=readFrame(v);
size(f)
%  240   320     3
>> v = VideoReader('rhinos.avi');
>> currAxes = axes;
>>  while hasFrame(v)
vidFrame = readFrame(v);
image(vidFrame,'Parent',currAxes);
currAxes.Visible = 'off';
pause(1/v.FrameRate);
end
%读取视频中的所有的帧，并且依次显示出来. 效果等同于视频